package com.shouhe.mysap.controller.pur;


import com.shouhe.mysap.common.PageResult;
import com.shouhe.mysap.service.PurOrderService;
import com.shouhe.mysap.service.PurPersonService;
import com.shouhe.mysap.util.PageResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * 在途采购订单控制器
 *  pur_order表
 * </p>
 * @author 守鹤
 * @since 2020-06-10
 */
@RestController
@RequestMapping("/pur-order")
public class PurOrderController {

    @Autowired
    private PurOrderService purOrderService;

    /**
     * 得到全部采购在途订单
     * @param page 前端传递的页码
     * @param rows 前端传递的显示条数
     * @param purGroup 采购组
     * @param supplierName 供应商名字
     * @return 分页显示对象
     */
    @RequestMapping("/getPurOrders")
    public PageResult getPurPersons(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer rows,@RequestParam(defaultValue = "-1") Integer purGroup,@RequestParam(defaultValue = "null") String supplierName) {
        Map<String, Object> eqMap = new HashMap<>();
        Map<String, Object> likeMap = new HashMap<>();
        eqMap.put("pur_group",purGroup);
        likeMap.put("supplier_name",supplierName);
        PageResult pageResult = PageResultUtil.getPageResultEqLikeMap(page, rows, purOrderService,eqMap,likeMap);
        return pageResult;
    }


}

